-- pixy_well
-- created by panyl
-- 地牢格子：妖精的井

return {
    -- 自动战斗
    autoFight = function(grid)
        local pos = grid:getPos();
        local dbase = DungeonM.queryElement(grid.element, "dbase");
        if type(dbase) == "table" and type(dbase["need_property"]) == "number" then
            if ItemM.getAmount(ME.user, dbase["need_property"]) > 0 then
                -- 扔妖精的钱币
                return DungeonActionM.go("pixy_well_event", pos);
            end
        end

        -- 50/100中随机选择
        DungeonActionM.go("pixy_throw_coin", pos, math.random(1, 2));
    end,
};
